<template>
  <div>
    <nav-header></nav-header>
    <nav-bread>
      <span>Order Success</span>
    </nav-bread>
    <div>
      <div class="container">
        <div class="page-title-normal">
          <h2 class="page-title-h2"><span>check out</span></h2>
        </div>
        <!-- 进度条 -->
        <div class="check-step">
          <ul>
            <li class="cur"><span>Confirm</span> address</li>
            <li class="cur"><span>View your</span> order</li>
            <li class="cur"><span>Make</span> payment</li>
            <li class="cur"><span>Order</span> confirmation</li>
          </ul>
        </div>

        <div class="order-create">
          <div class="order-create-pic"><img src="/static/ok-2.png" alt="" v-if="orderInfo.orderId"><p v-if="!orderInfo.orderId">无此订单!</p></div>
          <div class="order-create-main">
            <h3>Congratulations! <br>Your order is under processing!</h3>
            <p>
              <span>Order ID：{{ orderInfo.orderId}}</span>
              <span>Order total：{{  orderInfo.orderTotal | currency('$')}}</span>
            </p>
            <div class="order-create-btn-wrap">
              <div class="btn-l-wrap">
                <router-link to="/cart" class="btn btn--m">Cart List</router-link>
              </div>
              <div class="btn-r-wrap">
                <router-link to="/" class="btn btn--m">Goods List</router-link>
              </div>
            </div>
          </div>
        </div>
      </div>
    </div>
    <nav-footer></nav-footer>
  </div>
</template>

<script>
  import NavHeader from '../components/Header.vue';
  import NavFooter from '../components/Footer.vue';
  import NavBread from '../components/Bread.vue';
  import Modal from '../components/Modal.vue';

  export default {
    data(){
      return {
        orderInfo : {},
      }
    },
    mounted(){
      this.getOrderInfo();
    },
    methods : {
      getOrderInfo(){
        let orderId = this.$route.query.orderId;
        if (!orderId){
          return;
        }
        this.$http.post('user/orderInfo',{
          params : {
            orderId : orderId,
          },
        }).then(response=>{
          let res= response.data;
          if (res.status === 0){
            this.orderInfo = res.result;
            console.log(res);
          }
        });
      },
    },
    name: "OrderSuccess",
    components: {
      NavHeader,
      NavFooter,
      NavBread,
      Modal
    },
  }
</script>

<style scoped>

</style>
